﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using VOD.Models;

namespace VOD.Controllers.Filters
{
    public class LoginLogFilter : FilterAttribute, IActionFilter
    {
        public void OnActionExecuted(ActionExecutedContext filterContext)
        {
            if (HttpContext.Current.Request.IsAuthenticated)
            {
                var db = new VODEntities();
                SystemLog log = new SystemLog
                {
                    AddDate = DateTime.Now,
                    Description = String.Format("{0} 登录成功!",HttpContext.Current.User.Identity.Name)
                };
                db.SystemLogs.Add(log);
                db.SaveChanges();
            }
        }

        public void OnActionExecuting(ActionExecutingContext filterContext)
        {
            
            
        }

    }
}